<!-- eslint-disable vue/multi-word-component-names -->
<template>
  <div class="common-layout">
    <el-container>
      <!-- Header -->
      <el-header>
        <el-menu
          :default-active="activeIndex"
          class="el-menu-demo top"
          mode="horizontal"
          @select="handleSelect"
        >
          <el-menu-item index="1" @click="this.$router.push('/')">首页</el-menu-item>
          <el-menu-item index="2" @click="this.$router.push('/services')">存取</el-menu-item>
          <el-menu-item index="3" @click="this.$router.push('/about')">关于</el-menu-item>
          <el-menu-item index="4" @click="this.$router.push('/admin')">后台</el-menu-item>
        </el-menu>
      </el-header>

      <el-container>
        <!-- Aside (Sidebar) -->
        <el-aside width="200px">
          <el-menu
            default-active="2"
            class="el-menu-vertical-demo"
            :collapse="isCollapse"
            @open="handleOpen"
            @close="handleClose"
          >
            <el-sub-menu index="1">
              <template #title>
                <el-icon><location /></el-icon>
                <span>用户管理</span>
              </template>
              <el-menu-item index="1-1"><el-icon><Lock /></el-icon>封禁用户</el-menu-item>
              <el-menu-item index="1-2"><el-icon><CloseBold /></el-icon>注销用户</el-menu-item>
              <el-menu-item index="1-3"><el-icon><user /></el-icon>用户信息</el-menu-item>
            </el-sub-menu>
            <el-menu-item index="2"><el-icon><MessageBox /></el-icon>站内信管理</el-menu-item>
            <el-menu-item index="3"><el-icon><Box /></el-icon>柜子管理</el-menu-item>
            <el-menu-item index="4"><el-icon><document /></el-icon>工单管理</el-menu-item>
            <el-menu-item index="5"><el-icon><setting /></el-icon>系统管理</el-menu-item>
          </el-menu>
        </el-aside>
        
        <!-- Main Content Area -->
        <el-main>Main</el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script lang="js">
import { Location, Lock, CloseBold, User, MessageBox, Box, Document, Setting } from '@element-plus/icons-vue'

export default {
  data()
  {
    return {
      isCollapse: false,
      activeIndex: '1'
    }
  },
  methods: {
    handleOpen(key, keyPath)
    {
      console.log(key, keyPath)
    },
    handleClose(key, keyPath)
    {
      console.log(key, keyPath)
    },
    handleSelect(index)
    {
      // Handle menu select logic here
    }
  },
  components: {
    Location,
    Lock,
    CloseBold,
    User,
    MessageBox,
    Box,
    Document,
    Setting
  }
}
</script>

<style scoped>
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 200px;
  min-height: 400px;
}

.top {
  display: flex;
  justify-content: center;
  gap: 40px;
}
</style>
